import React, { useState } from 'react'
import routes from '../src/router/Index'
import { RouterProvider } from 'react-router-dom'
import { store } from '../src/store/index'
import { Provider } from 'react-redux'
import { Button, ConfigProvider, Input, Space, theme as antdTheme } from 'antd';
function App() {
  const [theme,setTheme]=useState('light')
  return (
    <div>
       <ConfigProvider
    theme={{
      // 1. 单独使用暗色算法
      algorithm: theme=='dark'?antdTheme.darkAlgorithm:antdTheme.defaultAlgorithm,

      // 2. 组合使用暗色算法与紧凑算法
      // algorithm: [theme.darkAlgorithm, theme.compactAlgorithm],
    }}
  >
    <Space>
      <Button type="primary" onClick={()=>setTheme(theme=='light'?'dark':'light')}>
        {theme=='light'?'点击切换主题':'点击切换主题'}
      </Button>
    </Space>
      <Provider store={store}>
          <RouterProvider router={routes}></RouterProvider>
       </Provider>
  </ConfigProvider>
     
    
    </div>
  )
}

export default App
